using System;
using System.Data;
using System.Collections;

namespace dmWS
{
	/// <summary>
	/// Summary description for KTProperties.
	/// </summary>
	public class KTProperties
	{

		public KTProperties()
		{
		  
		}

		public Hashtable getRestrictedPermissions(string projectId)
		{
			//ritorna lookupid e objectid delle sottocartelle di running, creati una volta sola
			//che poi saranno utilizzati anche in closed
			DataBase Db = new DataBase(System.Configuration.ConfigurationSettings.AppSettings["ktdb"].ToString());
			Hashtable result = new Hashtable();		

			return result;
		}

		public Hashtable getData(string type)
		{
			DataBase Db = new DataBase(System.Configuration.ConfigurationSettings.AppSettings["ktdb"].ToString());
			
			Hashtable result = new Hashtable();		
			string idi = System.Configuration.ConfigurationSettings.AppSettings[type].ToString();
			result.Add("id",idi);

			//seleziono i figli della cartella planned (o mediated, o adhoc)
			string query = "select son.id, son.name from folders as son "+
				"join folders as parent on (son.parent_id = parent.id) where parent.id = '"+idi+"'";
			MySql.Data.MySqlClient.MySqlDataReader rea = Db.ExecuteQuery(query);
			
			while(rea.Read())
			{				
				result.Add(rea["name"].ToString(), rea["id"].ToString());
			}
			rea.Close();
			Db.CloseConnection();

			return result;
		}


	}
}
